package com.wuzf.demo.demo.bootstrap;

import com.wuzf.demo.demo.repository.MyFirstLevelRepository;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;

@ComponentScan("com.wuzf.demo.repository")
public class RepositoryBootstrap {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = new SpringApplicationBuilder(RepositoryBootstrap.class)
                .web(WebApplicationType.NONE)
                .run(args);
        MyFirstLevelRepository result =
                context.getBean("firstLevelRepository", MyFirstLevelRepository.class);
        System.out.println("firstLevelRepository bean：" + result);

        // 关闭
        context.close();
    }
}
